import time

import paho.mqtt.client as mqtt

HOST = "47.101.189.16"
PORT = 1883


def test():
    client = mqtt.Client()
    client.connect(HOST, PORT, 60)
    for i in range(1,3):
        client.publish(f"$SYS/brokers/emqx@127.0.0.1/clients/{i}/connected", "hello")
        # time.sleep(5)
        # client.publish(f"$SYS/brokers/emqx@127.0.0.1/clients/{i}/disconnected","world")
    client.loop_forever()


if __name__ == '__main__':
    test()
